package factory;

import java.util.Date;

import javax.inject.Inject;
import javax.inject.Singleton;

import service.AssociationService;
import service.NoAssociationService;
import service.UnionAssociationService;
import dao.UnionDueDao;
import entity.Employee;
import entity.Union;
@Singleton
public class AssociationServiceFactory  {
	@Inject UnionDueDao unionDueDao;
	public  AssociationService CreateAssociationService(Employee employee,Date lastPayDay){
		AssociationService service=null;
		if(employee.getAssociation() instanceof Union){
			((Union)employee.getAssociation()).setUnionDues(unionDueDao.ListUnionDueEmployee(employee));
			service=new UnionAssociationService(employee,lastPayDay);
		}
		if(employee.getAssociation() == null){
			service=new NoAssociationService();
		}
		return service;
	}
}
